package org.go.scheduler.rmi;

import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.concurrent.ConcurrentHashMap;

import org.go.expcetion.GoException;
import org.go.expcetion.JobPersistenceException;
import org.go.expcetion.SchedulerException;
import org.go.trigger.Trigger;
import org.go.trigger.TriggerKey;
import org.go.work.Work;

/**
 * 
 * @author hejie
 *
 */
public interface IRmiScheduler extends Remote {
	/**
	 * 
	 * @return
	 */
	ConcurrentHashMap<String, Object> getContext() throws SchedulerException, RemoteException;

	/**
	 * 
	 * @return
	 */
	String getJobGroupNames() throws SchedulerException, RemoteException;;

	/**
	 * 
	 * @return
	 * @throws GoException
	 */
	String getSchedulerName() throws SchedulerException, RemoteException;;

	/**
	 * 
	 * @param tKey
	 * @return
	 */
	Trigger getTrigger(TriggerKey tKey) throws SchedulerException, RemoteException;

	/**
	 * 
	 * @return
	 * @throws GoException
	 */
	boolean isShutdown() throws SchedulerException, RemoteException;

	/**
	 * 
	 * @param string
	 * @param se
	 */
	void notifySchedulerListenersError(String string, GoException se) throws SchedulerException, RemoteException;;

	/**
	 * 
	 * @param string
	 * @param se
	 */
	void notifySchedulerListenersError(String string, JobPersistenceException se) throws SchedulerException, RemoteException;;

	/**
	 * 
	 * @param desc
	 * @throws SchedulerException
	 */
	void scheduler(Work work, Trigger trigger) throws SchedulerException, RemoteException;

	/**
	 * 
	 * @param cleanShutdown
	 * @throws SchedulerException
	 */
	void shutdown(boolean cleanShutdown) throws SchedulerException, RemoteException;

	/**
	 * 
	 * @throws GoException
	 */
	void shutdownNow() throws SchedulerException, RemoteException;;

	/**
	 * 
	 */
	void start() throws SchedulerException, RemoteException;

	/**
	 * 
	 * @throws GoException
	 */
	void startAll() throws SchedulerException, RemoteException;

	/**
	 * 
	 * @param seconds
	 * @throws GoException
	 */
	void startDelayed(int seconds) throws SchedulerException, RemoteException;;

	/**
	 * 
	 * @param workerId
	 * @throws GoException
	 */
	void startWorker(String workerId) throws SchedulerException, RemoteException;

	/**
	 * 
	 * @param tKey
	 */
	void unscheduleWork(Work workerDesc) throws SchedulerException, RemoteException;

	/**
	 * 
	 * @throws SchedulerException
	 */
	void pauseAllWorks() throws SchedulerException, RemoteException;
}
